﻿@model ECSE6770.Cart

@if (Model.Count> 0)
{
    <table class="cart wide">
        <thead>
            <tr>
                <th>Item</th>
                <th>Description</th>
                <th>Price</th>
                <th></th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <td></td>
                <td style="text-align: right;">Total:</td>
                <td>@String.Format("{0:c}", Model.TotalCost)</td>
                <td></td>
            </tr>
        </tfoot>
        <tbody>
            @foreach (var buyable in Model.ProductEntityItems())
            {
                <tr>
                    <td>@buyable.LinkToItem(Html, buyable.Title)</td>
                    <td class="markup">@Html.Raw(buyable.Teaser)</td>
                    <td>@buyable.PriceString()</td>
                    <td>@Html.ActionLink("Remove", "RemoveItem", new {  id = buyable.Id }, new { onclick = "return confirm('Are you sure you wish to remove this item?')" })</td>
                </tr>
            }
        </tbody>
    </table>
    using (Html.BeginForm("Checkout", "Cart", FormMethod.Get))
    {
        <p style="text-align: right;">
            <input type="submit" value="Checkout" />
        </p>
    }
}
else
{
    <p>You have no items in your cart.</p>
    <ul>
        <li>@Html.ActionLink("View Available Modules", "Modules", "Home")</li>
        <li>@Html.ActionLink("View Available Videos", "Videos", "Home")</li>
    </ul>
}